﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IllustratedCsharp7_ch19_EnumeratorsAndIterators
{
    class chapt19_2IEnumeratorInterface
    {
        static void _Main()
        {
            int[] arr1 = { 10, 21, 12, 13 };
            IEnumerator ie = arr1.GetEnumerator();  //获取并存储枚举器

            while (ie.MoveNext())    //移到下一项
            {
                int item = (int)ie.Current;
                Console.WriteLine($"Item value:{ item}");   //输出
            }
            Console.Read();
        }
    }
}
